using System;
using System.Collections.Generic;
using System.Text;
using DAL;
using Utility;
using DTO;

namespace BUS
{
  public   class tbhinhthucthanhtoanBUS
    {
        public static tbhinhthucthanhtoancollection Get(string where,
         int pageindex,
         int pagesize,
         string orderby,
         string orderdirection,
         out int total)
        {
            tbhinhthucthanhtoanDAL hinhthucthanhtoanDAL = new tbhinhthucthanhtoanDAL();
            return hinhthucthanhtoanDAL .Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static tbhinhthucthanhtoancollection GetAll()
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbhinhthucthanhtoanDAL hinhthucthanhtoanDAL = new tbhinhthucthanhtoanDAL();
            return hinhthucthanhtoanDAL.Get(cri.Criter, 0, 0, hinhthucthanhtoancolumns.mahinhthucthanhtoan .ToString(), OrderDirection.ASC.ToString(), out total);
        }
        public static tbhinhthucthanhtoan GetByID(int iD)
        {
            int total = 0;
            Criteria cri = new Criteria();
            cri.add(Condition.AND, hinhthucthanhtoancolumns.mahinhthucthanhtoan .ToString(), Condition.EQUAL, iD);
            tbhinhthucthanhtoanDAL hinhthucthanhtoanDAL = new tbhinhthucthanhtoanDAL();
            tbhinhthucthanhtoancollection hinhthucthanhtoancollection = hinhthucthanhtoanDAL .Get(cri.Criter,
                     0, 0, hinhthucthanhtoancolumns.mahinhthucthanhtoan.ToString(), OrderDirection.ASC.ToString(), out total);
            if (hinhthucthanhtoancollection.Count > 0)
                return hinhthucthanhtoancollection[0];
            return null;
        }
    }
}
